<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>考试信息后台管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="stylesheet" href="/static/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.css">
    <link rel="stylesheet" href="/static/plugins/DataTables/datatables.min.css">
    <link rel="stylesheet" href="/static/plugins/DataTables/DataTables-1.10.16/css/dataTables.bootstrap.min.css">
    <link rel="stylesheet" href="/static/plugins/sumoselect/sumoselect.min.css">
    <link rel="stylesheet" href="/static/plugins/summernote/dist/summernote.css">
    <link rel="stylesheet" href="/static/plugins/font-awesome/css/font-awesome.min.css">
    {block name="pluginsCss"}{/block}
    <link rel="stylesheet" href="/static/css/plugins.reset.css">
    <link rel="stylesheet" href="/static/css/common.css">
    <link rel="stylesheet" href="/static/css/icon.css">
    <link rel="stylesheet" href="/static/css/admin.css">
    <link rel="stylesheet" href="/static/css/style.css">
    <style>
        .windowForm {
            padding: 20px;
            display: none;
        }
        .windowForm p {
            font-size: 14px;
            text-align: left;
            color: #858585;
        }
        .windowForm input.longInput {
            display: block;
            border: 1px solid #ddd;
            width: 311px;
            height: 28px;
            margin: 8px auto;
            font: 14px/28px Arial;
            text-indent: 5px;
            color: #858585;
            background: #fff;
        }
        .windowForm .confirmBtn {
            padding-top: 15px;
        }
        .windowForm .button-confirm {
            position: relative;
            border: 1px solid #1fa9ff;
            border-radius: 2px;
            text-align: center;
            color: #fff;
            background: #1fa9ff;
            box-sizing: content-box;
        }
        .windowForm .button-confirm:hover {
            color: #fff;
            background: #3d8cd9;
        }
        .windowForm .confirmBtn a {
            display: inline-block;
            border-radius: 3px;
            width: 100%;
            height: 34px;
            font: 14px/34px "PingFangSC-Regular", "HelveticaNeue-Light", "Helvetica Neue Light", "Microsoft YaHei", "sans-serif";
            vertical-align: middle;
            letter-spacing: normal;
            word-spacing: normal;
        }
    </style>
    {block name="style"}{/block}
</head>
<body>
<div class="wrapper loaded">
    <div class="leftWrapper">
        <div class="logoWrapper">
            <h1 class="logo">
                <a href="{:url('index/index')}"><img src="/static/images/logo.png" alt="LOGO"></a>
            </h1>
        </div>
        <div class="menuWrapper">
            <ul class="menu" id="admin-menu">
                <li>
                    <a href="{:url('index/index')}">
                        <i class="fa fa-home"></i>
                        <span>首页</span>
                    </a>
                </li>
                <li>
                    <a href="{:url('user/lists')}">
                        <i class="fa fa-users"></i>
                        <span>考生信息管理</span>
                    </a>
                </li>
                <li>
                    <a href="{:url('major/lists')}">
                        <i class="fa fa-home"></i>
                        <span>专业信息管理</span>
                    </a>
                </li>
                <li>
                    <a href="{:url('course/lists')}">
                        <i class="fa fa-user"></i>
                        <span>课程信息管理</span>
                    </a>
                </li>
                <li>
                    <a href="{:url('exam/lists')}">
                        <i class="fa fa-user"></i>
                        <span>考试信息管理</span>
                    </a>
                </li>
                <li>
                    <a href="{:url('paper/lists')}">
                        <i class="fa fa-user"></i>
                        <span>试卷管理</span>
                    </a>
                </li>
                <li>
                    <a href="{:url('question/lists')}">
                        <i class="fa fa-user"></i>
                        <span>试题管理</span>
                    </a>
                </li>
                <li>
                    <a href="{:url('achievement/lists')}">
                        <i class="fa fa-user"></i>
                        <span>考试成绩管理</span>
                    </a>
                </li>
                <li>
                    <a href="{:url('manager/lists')}">
                        <i class="fa fa-user"></i>
                        <span>管理员信息管理</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <div class="rightWrapper">
        <div class="navWrapper">
            <div class="user-nav">
                <ul>
                    <li class="dropdown" id="profile-messages">
                        <a title="" href="#" data-toggle="dropdown" data-target="#profile-messages" class="dropdown-toggle">
                            <i class="fa fa-user"></i>
                            <span class="text">{$Think.session.admin.username|default='Gallonce'}</span>
                            <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a id="editPassword" href="javascript:"><i class="fa fa-cog"></i>修改密码</a></li>
                            <li class="divider"></li>
                            <li><a href="{:url('index/logout')}"><i class="fa fa-sign-out"></i>退出</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
        <div id="editPasswordWrapper" class="windowForm">
            <form id="editPasswordForm">
                <p>密码</p>
                <p class="mb20">
                    <input class="longInput" type="password" name="password" value="">
                </p>
                <p>确认密码</p>
                <p class="mb20">
                    <input class="longInput" type="password" name="repassword" value="">
                </p>
                <div class="confirmBtn">
                    <a id="editPasswordConfirm" class="button-confirm" href="javascript:">确定</a>
                </div>
            </form>
        </div>
        <div class="contentWrapper">
            <div class="bg-dashboard" id="content">
                {block name="body"}{/block}
            </div>
        </div>
        <footer class="footerWrapper">
            <div class="copyright">
                Copyright © 2017 <a href="javascript:">Gallonce</a> , Inc. All rights reserved.
            </div>
        </footer>
    </div>
</div>


<script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.js"></script>
<script src="/static/plugins/bootstrap-datetimepicker/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="/static/plugins/layui/layui.all.js"></script>
<script src="/static/plugins/DataTables/DataTables-1.10.16/js/jquery.dataTables.js"></script>
<script src="/static/plugins/DataTables/DataTables-1.10.16/js/dataTables.bootstrap.min.js"></script>
<script src="/static/plugins/sumoselect/jquery.sumoselect.min.js"></script>
<script src="/static/plugins/validator/validator.min.js"></script>
<script src="/static/plugins/sumoselect/jquery.sumoselect.min.js"></script>
<script src="/static/plugins/sweetalert/sweetalert2.all.min.js"></script>
<script src="/static/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/static/plugins/summernote/dist/summernote.js"></script>
<script src="/static/plugins/summernote/dist/lang/summernote-zh-CN.js"></script>
{block name="pluginsJs"}{/block}
<script src="/static/js/common.js"></script>
<script src="/static/js/admin.js"></script>
<script>
    (function ($) {
        var passwordValidator = new Validator('editPasswordForm', [
            {
                name: 'password',
                display: '请输入密码',
                rules: 'required'
            },
            {
                name: 'repassword',
                display: '请输入确认密码|两次密码不一致',
                rules: 'required|same(password)'
            }
        ], function (obj, evt) {
            //如果errors具有内容则表示验证不通过
            if (obj.errors.length) {
                $.each(obj.errors, function (index, item) {
                    layer.tips(item.message, $('#editPasswordForm').find('[name="' + item.name + '"]'), {
                        tips: [2, '#00B4E9'],
                        tipsMore: true
                    });
                });
            }
        });

        $('#editPassword').on('click', function () {
            layer.open({
                type: 1,
                title: '修改密码',
                area: ['auto'],
                content: layui.jquery('#editPasswordWrapper')
            });
        });
        $('#editPasswordConfirm').on('click', function () {
            if(!passwordValidator.validate().errors.length) {
                var password = $('#editPasswordWrapper').find('[name="password"]').val();
                $.ajax({
                    url: "{:url('editPassword')}",
                    type: 'post',
                    data: {
                        password: password
                    }
                }).done(function (response) {
                    if (response.status) {
                        layer.closeAll();
                        layer.msg('修改密码成功！');
                        $('#editPasswordWrapper').find('[name="password"]').val('');
                        $('#editPasswordWrapper').find('[name="repassword"]').val('');
                    } else {
                        layer.msg(response.message);
                    }
                }).fail(function () {
                    console.error('重置密码发送失败！');
                });
            }
        })
    })($);
</script>
{block name="script"}{/block}
</body>
</html>